/* The link = http://poj.org/problem?id=1056
 * Add a re for the 10 length of arrays
 */

#include <iostream>

using namespace std;

const int MAX_NUMBER_OF_BITS = 20;
const int MAX_NUMBER_OF_CODES = 10;
char record[MAX_NUMBER_OF_CODES][MAX_NUMBER_OF_BITS];

bool isPrefix(char *record1, char *record2)
{
	//int len1 = sizeof(record1);
	//int len2 = sizeof(record2);
	//for (int i = 0; i < len1; i++) {
	//	if (record1[i] != record2[i])
	//		return false;
	//}
	for (int i = 0; record1[i] != '\0' && record2[i] != '\0'; i++) {
		if (record1[i] != record2[i]) {
			return false;
		}
	}
	return true;
}

int main(int argc, char *argv[])
{
	int sets = 1;
	int i = 0;
	while (scanf("%s", record[i++]) != EOF) {
		if (record[i - 1][0] == '9') {
			bool hasPrefix = false;
			for (int j = 0; j < i - 2 && !hasPrefix; j++) {
				for (int k = j + 1; k < i - 1 && !hasPrefix; k++) {
					// Check if the record[j] and record[k] is the prefix of the other
					if (isPrefix(record[j], record[k])) {
						hasPrefix = true;
						break;
					}
				}
			}
			if (hasPrefix)
				cout << "Set " << sets << " is not immediately decodable" << endl;
			else
				cout << "Set " << sets << " is immediately decodable" << endl;
			++sets;
			i = 0;
		}
	}
	return 0;
}